-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Patterns: Fix issue with template in replace template screen #56407
Conversation
Size Change: +67 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
@@ -71,7 +72,9 @@ function BlockPattern( { | |||
} } | |||
> | |||
<WithToolTip | |||
showTooltip={ showTooltip && ! pattern.id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing bug really only needed the change to pattern.type
in this file, but I thought it was better to update all the uses of the pattern.id
check now as the issue may appear in other areas if we start mixing patterns and templates more in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix here @glendaviesnz 👍
Looks like there are a couple of places in the code that still need to be switched to user pattern.type
:
That was only after an quick search so I wouldn't take that list as exhaustive. There could be others.
🚀 Looks like you pushed those required updates while I was typing up the review. I'll give it another review in a moment. |
Thanks. The other instances I could find seemed to be valid uses of id but let me know if you spot any more. I have updated test instructions to cover the site editor changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still missing one use of pattern.id
to determine the difference between user & theme patterns:
Other than that, I couldn't find any further uses of the id check approach.
Thanks, not sure how I missed that. I have fixed and updated test instructions to check duplicated pattern sync status to cover this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the iterations here.
I couldn't find any further uses of pattern.id
or item.id
to check for theme patterns. After checking out the latest commits everything is testing as advertised for me.
✅ When switching templates, the options do not have a purple highlight or pattern icon
✅ The pattern inserter displays the correct icons and highlights for user patterns
✅ Pattern inserter's sync filters work as expected
✅ Site editor's pattern management page sync filters continue to work
✅ Duplicating user and theme patterns work correctly
For backporting there have been quite a few changes in the affected areas since 6.4, so it might be easier to just do a small patch for the specific bug rather than this wider refactor. Ping me when the next 6.4.* build it being done and I can co-ordinate this. |
👋 @glendaviesnz, 6.4.2 is currently being worked on. We have a PR here for the package updates: WordPress/wordpress-develop#5698. It hasn't been committed yet, so this change could still be included. I'm at a meetup next week so may be slow to reply, but it may be worth coordinating the patch for this change next week. cc. @karmatosed @SiobhyB @tellthemachines |
I'm happy to help where needed! Is there a date set for 6.4.2 yet? |
@tellthemachines, @SiobhyB, @karmatosed I think it is probably best to only include the bug fix changes in 6.4.2 rather than the full refactor in this PR, eg. just the changes in this file. Is the best way to do that to open a PR with just that change against wp/6.4 branch? |
I'd say so, yes. Definitely let's avoid adding new features in a minor release 😅 |
Have added a minimal fix here #56538 |
What?
Fixes an issue with some templates displaying as synced patterns by mistake.
Why?
In the switch templates screen on the page editor the templates show the synced pattern icon and highlighting which is confusing to users.
Fixes: #56380
How?
This screen was identifying user patterns by the presence of
pattern.id
but it turns out that some templates also have anid
field set. This PR adds atype=user
field to user patterns to more reliably identify them.Testing Instructions
User
still work as expectedScreenshots or screencast
Before:
pattern-icon-before.mp4
After:
pattern-icon-after.mp4